#include"headfile.h"


void headAdd(memNode* * p, memNode * newP) //头插
{
    if(NULL == p || NULL == newP) return;
    if(NULL != *p) newP->next = *p;
    *p = newP;
}


void tailAdd(memNode* * p,memNode * newP) //尾插
{
    if(NULL == p || NULL == newP) return;
    memNode* pTemp = *p;
    if(NULL != *p) //非空
    {
        while(NULL != pTemp->next)
        {
            pTemp = pTemp->next;//此时 pTemp非NULL pTemp->next为NULL 就是尾节点
        }
        pTemp->next = newP;
    }
    else
    {
        *p = newP;
    }
}
